<?php

class Connection {
    private $link;
    
    function __construct($Host, $User, $Password, $DataBase) {
        $this->link = @mysql_connect($Host,$User,$Password) or die ("error al conectar ".mysql_error());
        @mysql_select_db($DataBase,$this->link) or die("error al seleccionar la DB".mysql_error());
    }

    public function ejecutar ($sql) {

        $result = @mysql_query($sql,$this->link) or die ("error al ejecutar el $sql");

        return $result;
    }

    public function closeConection() {
        mysql_close ($this->link);
        exit;
    }

    public function __toString() {
        return "".$this->link;
    }
}

?>
